package org.redisson.service;

import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;

/**
 * Created by MD on 2018/5/21.
 */
@Service
public class HelloWordService {
    public String say(){
        RedissonClient redissonClient = Redisson.create();
        RLock rLock =  redissonClient.getLock("HelloWord");
        rLock.lock();
        System.out.print("现在只有我能说话");
        rLock.unlock();
        return "Hello Word!";
    }
}
